package com.orangelife.mobile.hourlyEmployee.activity;

import java.util.Map;

import android.app.Dialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

import com.curry.orangelife.mobile.R;
import com.orangelife.mobile.app.application.ExitApplication;
import com.orangelife.mobile.common.activity.OrangeLifeBaseActivity;

public class OrderSuccessActivity extends OrangeLifeBaseActivity {
	
	/**标题中间*/
	private TextView tvTitle;
	/** 标题右边*/
	private TextView tvTitleRight;
//	/**订单编号*/
//	private TextView tvOrderNumber;
//	/** 服务价格*/
//	private TextView tvServicePrice;
//	/** 名字*/
//	private TextView tvName;
//	/**电话*/
//	private TextView tvPhoneNumber;
//	/** 地址*/
//	private TextView tvAddress;
//	/**服务时间*/
//	private TextView tvServiceTime;
//	/** 备注*/
//	private TextView tvRemark;
	/**查看详情*/
	private Button btnLookDetail;
	/**完成*/
	private Button btnComplete;
	/**接收从后台传来的数据*/
	private Map<String,Object> mapDetail;
	private Dialog dialog;


	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_hourly_employee_order_success);
		initeView();
		findView();
	}
	
	private void initeView(){
		tvTitle = (TextView)findViewById(R.id.tv_title);
		tvTitleRight = (TextView)findViewById(R.id.tv_title_right);
//		tvOrderNumber = (TextView)findViewById(R.id.tvOrderNumber);
//		tvServicePrice = (TextView)findViewById(R.id.tvServicePrice);
//		tvServiceTime = (TextView)findViewById(R.id.tvServiceTime);
//		tvName = (TextView)findViewById(R.id.tv_username);
//		tvPhoneNumber = (TextView)findViewById(R.id.tv_userphone);
//		tvAddress = (TextView)findViewById(R.id.tv_address);
//		tvRemark = (TextView)findViewById(R.id.tvRemarks);
		btnComplete = (Button)findViewById(R.id.btnComplete);
		btnLookDetail = (Button)findViewById(R.id.btnLookDetail);
	}
	
	private void findView(){
		tvTitle.setText(R.string.hourly_employee);
		tvTitleRight.setVisibility(View.INVISIBLE);
		btnComplete.setOnClickListener(listener);
		btnLookDetail.setOnClickListener(listener);
		
	}
	
	/**
	 * 设置详情
	 */
//	private void setDetail(){
//		tvName.setText(mapDetail.get("").toString());
//		tvPhoneNumber.setText(mapDetail.get("").toString());
//		tvAddress.setText(mapDetail.get("").toString());
//		tvOrderNumber.setText(mapDetail.get("").toString());
//		tvServicePrice.setText(mapDetail.get("").toString());
//		tvServiceTime.setText(mapDetail.get("").toString());
//		String remark = mapDetail.get("").toString();
//		if(!StringUtil.isBlank(remark)){
//			tvRemark.setText("备注："+remark);
//		}
//	}
	
	/***
	 * 监听器
	 */
	private OnClickListener listener = new OnClickListener() {

		@Override
		public void onClick(View view) {
			Intent intent = new Intent();
			switch (view.getId()) {
			case R.id.btnLookDetail:
				ExitApplication.getInstance().addPaidActivity(OrderSuccessActivity.this);
				intent.putExtra("jumpuri", "1");
				intent.setClass(OrderSuccessActivity.this, OrderDetailActivity.class);
				startActivity(intent);
				break;
			case R.id.btnComplete:
				break;

			default:
				break;
			}
			finish();
		}
	};
	
	/**
	 * 获取详情
	 */
	
//	private void getDetail(){
//		Map<String, Object> map = new HashMap<String, Object>();
//		JSONRequest.getInstance().sendRequest(JSONRequest.GET, Constant.URL_ENJOYCLEAN_ADD, map, handler, 1, HttpUtil.ACTION_URI);
//	}
	
	/**
	 * 接收处理线程返回的消息
	 */
//	@SuppressLint("HandlerLeak")
//	private Handler handler = new Handler() {
//		@Override
//		public void handleMessage(android.os.Message msg) {
//			switch (msg.what) {
//			case Constant.WHAT_ERROR_HTTP:
//				ToastHelper.getInstance()._toast(String.valueOf(msg.obj));
//				break;
//			case 1:
//				mapDetail = new HashMap<String, Object>();
//
//				mapDetail = (Map<String, Object>) JSONHelper.jsonToMap(
//						msg.obj.toString()).get("entity");
//				DialogHelper.closeDialog(dialog);
//				setDetail();
//				break;
//			}
//			if (dialog != null) {
//				dialog.dismiss();
//			}
//		};
//	};
}
